package com.quanyan.authority.model.request;

import com.quanyan.common.utils.MD5Utils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.NotBlank;
import java.io.Serializable;

/**
 * Created by jian.zhou on 2016/8/4.
 */
public class ReqLogin implements Serializable {
    private static final long serialVersionUID = 980434179056196937L;

    @NotBlank(message = "loginName不能为空！")
    private String loginName;

    @NotBlank(message = "password不能为空！")
    private String password;

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPassword() {
        if(StringUtils.isNotBlank(this.password))
            return MD5Utils.MD5Encode(password);
        return "";
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "ReqLogin{" +
                "loginName='" + loginName + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
